package demo1;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 何华树
 * Date: 2024-08-07
 * Time: 20:14
 */
//class Date {
//    public int a;
//    public int b;
//    public Date() {
//        this(2,3);//调用了其他构造方法
//        System.out.println("调用了不带参数的构造方法。。。。");
//    }
//
//    public Date(int a,int b) {
//        this.a = a;
//        this.b = b;
//        System.out.println("调用了带有两个参数的构造方法");
//    }
//
//    public void show() {
//        System.out.println(this.a+this.b+"=a+b");
//    }
//}

class Teacher {
    private String name;
    private int age;
    private String workNum;

    public Teacher(String name, int age, String workNum) {
        this.name = name;
        this.age = age;
        this.workNum = workNum;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getWorkNum() {
        return workNum;
    }

    public void setWorkNum(String workNum) {
        this.workNum = workNum;
    }

    public void show() {
        System.out.println("姓名："+this.name);
        System.out.println("年龄："+this.age);
        System.out.println("工号："+this.workNum);
    }

    public static void test() {
        System.out.println("调用了静态方法。。");
    }
}
public class Test3 {
    public static void main(String[] args) {

    }
    public static void main3(String[] args) {
        Teacher teacher = new Teacher("王老师",27,"df2132s");

        teacher.test();//利用 对象的引用 调用 静态成员方法。

        Teacher.test();//利用 类名 调用 静态成员方法。
        //更推荐使用第二种方法，因为 静态成员方法 不依赖于对象。


    }
    public static void main2(String[] args) {
        Teacher teacher = new Teacher("王老师",27,"df2132s");
        teacher.show();
    }
    public static void main1(String[] args) {
//        Date date = new Date();
//        date.show();
    }
}
